<?php
/* @var $this SelisteController */
/* @var $model Seliste */
?>

<div class="container">
		
	<div class="row">
		<div class="col-lg-12">			
			<h1>Boite de réception</h1>
		</div>
	</div>
	
	<div class="row">
		<div class="col-md-12">
			<div class="btn-group">
			<?php echo CHtml::link('<span class="glyphicon glyphicon-pencil"></span> Nouveau',array("seliste/newmail"),array("class"=>"btn btn-primary"));?>
			<?php 
			$sentunread = '';
			$nbsentunread = Seliste::model()->getNbSentUnread(); 
			if ($nbsentunread) $sentunread = ' <span class="badge">' . $nbsentunread . '</span>';	
			echo CHtml::link('<span class="glyphicon glyphicon-send"></span> Envoyés' . $sentunread,array("seliste/sentmail"),array("class"=>"btn btn-primary"));?>	
			</div>								
		</div>
	</div>
	<div class="row">
		<div class="col-lg-12">
			
			<?php $this->widget('ext.bs3gridview.widgets.Bs3GridView', array(
				'id'=>'mailbox-grid',
				'dataProvider'=>$model->search(),
				'rowCssClassExpression' => '($data->lu==NULL ? "warning" : null)',
				'columns'=>array(
					'sujet',
					array (
							'name' => 'idseliste_em',
							'type' => 'html',
							'value'=>'$data->auto ? "-" : $data->idseliste_em . (($data->idselisteEm->v_pseudo == 1 || Yii::app()->user->admin) ? " (" . $data->idselisteEm->pseudo . ")" : "")'
					),	
					array(
							'name'=>'date',
							'value'=>'Yii::app()->dateFormatter->format(\'dd/MM/yyyy HH:mm:ss\',$data->date)'
					),
					array(
						'class'=>'CButtonColumn',
						'header'=>'Actions',
						'template' => '{view} {delete}',
						'viewButtonImageUrl' => false,
						'deleteButtonImageUrl' => false, 
						'buttons'=>array(
									'view'=>array(
											'label'=>"",
											'url'=>'Yii::app()->createUrl("seliste/mail", array("id"=>$data->id))',
											'options'=>array(
													"class"=>"glyphicon glyphicon-search",
													"title"=>"Voir"
											),
									),
									'delete'=>array(
											'label'=>"",
											'url'=>'Yii::app()->createUrl("seliste/delmail", array("id"=>$data->id))',
											'options'=>array(
												"class"=>"glyphicon glyphicon-remove",
												"title"=>"Supprimer"
												),
										),  
									),  
					),
				),
			)); ?>
		</div>
	</div>
</div>